home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1993 / Internet Info CD-ROM (Walnut Creek) (1993).iso / networking / osi / isode / dosisode / DOSISODE80.ZIP / ISODE8.WRK / UNIX / H / NETDB.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-09  |  2.4 KB  |  70 lines

  1. /*
  2.  * Copyright (c) 1980,1983,1988 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that this notice is preserved and that due credit is given
  7.  * to the University of California at Berkeley. The name of the University
  8.  * may not be used to endorse or promote products derived from this
  9.  * software without specific prior written permission. This software
  10.  * is provided ``as is'' without express or implied warranty.
  11.  *
  12.  *    @(#)netdb.h    5.9 (Berkeley) 4/5/88
  13.  */
  14.  
  15. /*
  16.  * Structures returned by network
  17.  * data base library.  All addresses
  18.  * are supplied in host order, and
  19.  * returned in network order (suitable
  20.  * for use in system calls).
  21.  */
  22. struct    hostent {
  23.     char    *h_name;    /* official name of host */
  24.     char    **h_aliases;    /* alias list */
  25.     int    h_addrtype;    /* host address type */
  26.     int    h_length;    /* length of address */
  27.     char    **h_addr_list;    /* list of addresses from name server */
  28. #define    h_addr    h_addr_list[0]    /* address, for backward compatiblity */
  29. };
  30.  
  31. /*
  32.  * Assumption here is that a network number
  33.  * fits in 32 bits -- probably a poor one.
  34.  */
  35. struct    netent {
  36.     char        *n_name;    /* official name of net */
  37.     char        **n_aliases;    /* alias list */
  38.     int        n_addrtype;    /* net address type */
  39.     unsigned long    n_net;        /* network # */
  40. };
  41.  
  42. struct    servent {
  43.     char    *s_name;    /* official service name */
  44.     char    **s_aliases;    /* alias list */
  45.     int    s_port;        /* port # */
  46.     char    *s_proto;    /* protocol to use */
  47. };
  48.  
  49. struct    protoent {
  50.     char    *p_name;    /* official protocol name */
  51.     char    **p_aliases;    /* alias list */
  52.     int    p_proto;    /* protocol # */
  53. };
  54.  
  55. struct hostent    *gethostbyname(), *gethostbyaddr(), *gethostent();
  56. struct netent    *getnetbyname(), *getnetbyaddr(), *getnetent();
  57. struct servent    *getservbyname(), *getservbyport(), *getservent();
  58. struct protoent    *getprotobyname(), *getprotobynumber(), *getprotoent();
  59.  
  60. /*
  61.  * Error return codes from gethostbyname() and gethostbyaddr()
  62.  * (left in extern int h_errno).
  63.  */
  64.  
  65. #define    HOST_NOT_FOUND    1 /* Authoritative Answer Host not found */
  66. #define    TRY_AGAIN    2 /* Non-Authoritive Host not found, or SERVERFAIL */
  67. #define    NO_RECOVERY    3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
  68. #define    NO_DATA        4 /* Valid name, no data record of requested type */
  69. #define    NO_ADDRESS    NO_DATA        /* no address, look for MX record */
  70.